#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int findLength(vector<int>& nums1, vector<int>& nums2)
    {
        vector<int> tmp(nums1.size() - 1, -1);
        for (int i = 0;i < nums2.size();++i)
        {
            tmp.push_back(nums2[i]);
        }
        tmp.resize(nums1.size() + nums1.size() * 2 - 2, -1);
        int Max = 0;
        for (int i = 0;i < (nums2.size() + nums1.size() - 1);++i)
        {
            int count = 0;
            for (int j = 0;j < nums1.size();++j)
            {
                if (tmp[j + i] == nums1[j])
                {
                    ++count;
                }
                else
                {
                    if (count > Max)
                    {
                        Max = count;
                    }
                    count = 0;
                }
            }
            if (count > Max) Max = count;
        }
        return Max;
    }
};